<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		<style type="text/css">
		input.btnleft{	text-align:	left;};
		.disp{border:0px;border-style:none;background-color:#99CCFF;}
		.celltext{
			width:88%;
			height:70%;
			*font-family: "MS Pゴシック","ＭＳ Ｐゴシック","MS P Gothic";
			font-size:11pt;
			line-height:120%;

		}
		td  {height:25px;}
		.errmsg{color:red;width:100%;};
		.all_div {
		  width:100%;
		  float: left;  /* 左方向にフロート */
		  position:relative;
		}
		table.sortable {
			margin:	0 0 0 0;
		}
		table.sortable th {
			padding: 0px 0px 0px 0px;
			margin:0 0 0 0;
			vertical-align: top;
			text-align:center;
			border: 1px solid #A0A0A0;
		}
		table.sortable td {
			padding: 0px 0px 0px 3px;
			margin:0 0 0 0;
			vertical-align: middle;
			border: 1px solid #A0A0A0;
		}
		table.sortable tr {height:38px;}
		.head_div {
		  float: left;   /* 左方向にフロート */
		  width:100%;
		  z-index:300;
		  padding-bottom: 0px;
		  margin-bottom: 0px;
		  overflow-x:hidden;
		  overflow-y:scroll;
		  scrollBar-face-color: #ffffff;
		  scrollBar-hightLight-color: #ffffff;
		  scrollBar-3dLight-color: #ffffff;
		  scrollBar-darkshadow-color:#ffffff;
		  scrollBar-shadow-color:#ffffff;
		  scrollBar-arrow-color:#ffffff;
		  scrollBar-track-color:#ffffff;
		  scrollBar-base-color:#ffffff;

		}
		/* 左カラム固定・*/
		.l_div {
		  width:100%;
		  height:500px;
		  float: left;
		  z-index:300;
  		  padding-top:0px;
  		  margin-top: 0px;
		  overflow-y:scroll;
		  overflow-x:hidden;
		}

 		</style>
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#btn-save').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fr.submit();
				}
			});
			$('#btn-export').click(function(){
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();

				}
			});
			
			$('#btn-import').click(function(){
				location.href = "mcost_flier_price_import.php?year4={{$forms.year4}}&sort={{$forms.sort}}";
			});
			
			$('#btn-reset').click(function(){
				location.href = document.fm.action;
			});
			$('#btn_search').click(function(){
				document.fm.csv.value="";
				document.fm.submit();
			});
			$('.sort').change(function(){
				var thesort = $('input:radio[name="sort"]:checked').val() ;

				if (thesort == 1) {
						$('#tr_op4')['show']();
					} else {
						$('#fm [name=block_cd]').val("");
						$('#tr_op4')['hide']();
				}
			});
		});
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.shop_cd.value = valcd;
				document.fm.shop_name.value = valnm;
			}
			if (gPara == "mediaid") {
				document.fmset.media_cd.value = valcd;
				document.fmset.media_name.value = valnm;
			}
			$('#dialog').dialog("close");
		}
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
{{$menu}}
{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>チラシ経費管理</h2>
			<ul class="submenu clearfix">
				<li><a href="mcost_flier_index.php">経費一覧・更新</a></li>
				<li><a href="mcost_flier_import.php">経費一括登録</a></li>
				<li>チラシ単価マスタ</li>
			</ul>
			<h3>チラシ単価マスタ</h3>
			<form name="fm" id="fm" method="get" action="mcost_flier_price.php" >
				<input type="hidden" name="page" />
				<table class="formTable">
					<tbody>
					<tr><th>※年度</th><td>
					{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}
					</td></tr>
						<tr>
							<th>※種類</th>
							<td>
{{ html_radios class="sort" name='sort' options=$sorts selected=$forms.sort separator='&nbsp;&nbsp;&nbsp;' }}

							</td>
						</tr>
						<tr id = "tr_op4"  style="display: {{if $forms.sort==1 }}block{{else}}none{{/if}};">
							<th>ブロック</th>
							<td>
{{ html_options id='block_cd'  name='block_cd' options=$block selected=$forms.block_cd }}
							</td>
						</tr>
					</tbody>
				</table>
					<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>

<form name="fr" id="fr"  action="mcost_flier_price_save.php" method="post">
	<input type="hidden" name="hsort"  value = "{{ $forms.sort }}"/>
	{{ if is_numeric($page.cnt) }}
	{{ if $page.cnt > 0 }}
	{{ if $msg }}
				<p class="message">{{ $msg }}</p>
				{{ if ($errmsg) }}
				<p class="error">{{ $errmsg }}</p>
				{{ /if }}
	{{ else  }}
				<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
	{{ /if }}
								<p class="button" style="text-align:right">
					<button type="button" id="btn-import" class="submit"><span>一括インポート</span></button>
				</p>
 <div class="head_div">
 <table  class="sortable" style="table-layout:fixed;word-wrap:break-word;word-break;break-all;">
	<tr>
		<th style="width:10%px">{{if $forms.sort==1 }}店舗{{else }}パターン{{/if}}コード</th>
		<th style="width:30%px">{{if $forms.sort==1 }}店{{else }}パターン{{/if}}名</th>
		<th style="width:20%px">B2価格</th>
		<th style="width:20%px">B3価格</th>
		<th style="width:20%px">B4価格</th>
	</tr>
</table>
 </div>
 <div class="l_div">
<table id="search_result" class="sortable" style="table-layout:fixed;word-wrap:break-word;word-break;break-all;">
 <tr style="height:1px;">
<th style="width:10%px;height:1px"></th>
<th style="width:30%px"></th>
<th style="width:20%px"></th>
<th style="width:20%px"></th>
<th style="width:20%px"></th>
 </tr>
{{ foreach from=$data key=k item=v name="member" }}
<tr class="{{cycle values=odd,mod name='member'}}">
	<td><input name="shop_cd[]"   type="text"   class="dtext" value="{{ $v.shop_cd}}" readonly/></td>
	<td><input name="shop_name[]" type="text"   class="dtext" value="{{ $v.shop_name}}" readonly/></td>
	<td align="center"><input name="b2[]"  type="text"  class="celltext" value="{{ $v.b2}}" /></td>
	<td align="center"><input name="b3[]"  type="text"  class="celltext" value="{{ $v.b3}}" /></td>
	<td align="center"><input name="b4[]"  type="text"  class="celltext" value="{{ $v.b4}}" /></td>
</tr>
{{ /foreach }}
</table>
 </div>
<p class="button"><button type="button" id="btn-save"  ><span>チラシ単価保存</span></button>
<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
</p>

{{ else }}
<p class="message">条件にマッチする情報は見つかりませんでした。</p>
{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}

</form>

<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>